//
//  DBManage.m
//  MooreDoll
//
//  Created by 郭景豪 on 2015/1/2.
//  Copyright (c) 2015年 Tank. All rights reserved.
//

#import "DBManage.h"

@implementation DBManage

+ (void)saveContext
{
    [[DBManageController sharedInstance].DB saveContext];
}


+(NSArray *)getRoster
{
    return [[DBManageController sharedInstance]getRoster];
}


+(NSArray *)coreDataSearchWithEntityName:(NSString *)entityName Predicate:(NSString *)predicateString sortDescriptor:(NSString *)sortString ascending:(BOOL)ascending
{
    return [[DBManageController sharedInstance]coreDataSearchWithEntityName:entityName Predicate:predicateString sortDescriptor:sortString ascending:ascending];
}

+(void)setFriend:(NSArray *)friends
{
    if (friends == nil) {
        return ;
    }
    [[DBManageController sharedInstance]setFriend:friends];
}

+(void)getVcardResult:(NSDictionary *)vcardInfo
{
    [[DBManageController sharedInstance]getVcardResult:vcardInfo];
}

+(void)changePresenceOnAndOffWithPresence:(BOOL)presence whoseJid:(NSString *)Jid
{
    [[DBManageController sharedInstance]changePresenceOnAndOffWithPresence:presence whoseJid:Jid];
}

+(void)whoseRoom:(NSString *)jid completionBlock:(void(^)(Room *room))completion failureBlock:(void(^)(BOOL noRoom))failureBlock
{
    [[DBManageController sharedInstance]whoseRoom:jid completionBlock:^(Room *room) {
        if (completion) {
            completion(room);
        }
    } failureBlock:^(BOOL noRoom) {
        if (failureBlock) {
            failureBlock(noRoom);
        }
    }];
}




@end
